package com.moliku.insurance.common.exception;


import com.moliku.insurance.common.constant.InsureStatusEnum;
import lombok.Getter;


/**
 * 投保业务异常
 *
 * @author Mr.Liu
 * @since 2020-02-03
 */
@Getter
@SuppressWarnings("unused")
public class SubmitPolicyException extends RuntimeException {
    private static final long serialVersionUID = 2359767895161832954L;


    private InsureStatusEnum insureStatus;

    private SubmitPolicyException() {

    }

    public SubmitPolicyException(String message) {
        super(message);
        this.insureStatus = InsureStatusEnum.INSURE_FAIL;
    }

    public SubmitPolicyException(String message, InsureStatusEnum resultCode) {
        super(message);
        this.insureStatus = resultCode;
    }

    public SubmitPolicyException(InsureStatusEnum resultCode) {
        super(resultCode.getMessage());
        this.insureStatus = resultCode;
    }

    /**
     * 提高性能
     *
     * @return Throwable
     */
    @Override
    public Throwable fillInStackTrace() {
        return this;
    }
}
